package com.fanshuai.mybatis_plus.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fanshuai.mybatis_plus.entity.UserTokenEntity;
import com.fanshuai.mybatis_plus.mapper.UserTokenMapper;
import org.springframework.stereotype.Repository;

@Repository
public class UserTokenDao extends ServiceImpl<UserTokenMapper, UserTokenEntity> {
    public UserTokenEntity queryByAccessToken(String accessToken) {
        return getOne(lambdaQuery().eq(UserTokenEntity::getAccessToken, accessToken));
    }

    public UserTokenEntity queryByRefreshToken(String refreshToken) {
        return getOne(lambdaQuery().eq(UserTokenEntity::getRefreshToken, refreshToken));
    }
}
